//
//  Optional.swift
//  Backhome
//
//  Created by vbn on 2018/9/11.
//  Copyright © 2018年 SmartHome. All rights reserved.
//

import Foundation

extension Optional where Wrapped == String {
    public var isNilOrEmpty: Bool {
        return self?.trimmingCharacters(in: .whitespaces).isEmpty ?? true
    }
}

extension Optional where Wrapped: Collection {
    public var isNilOrEmpty: Bool {
        switch self {
        case .some(let collection):
            return collection.isEmpty
        case .none:
            return true
        }
    }
}
